Carbon


IconActionProcPtr

Header: Icons.h Carbon status: Supported

Defines a pointer to an icon action callback function. Your icon action callback function performs an action on a single icon.

typedef OSErr(* IconActionProcPtr) (
    ResType theType, 
    Handle *theIcon, 
    void *yourDataPtr
);

You would declare your function like this if you were to name it MyIconActionCallback:

OSErr MyIconActionCallback (
    ResType theType, 
    Handle *theIcon, 
    void *yourDataPtr
);
theType

The resource type of the icon.

theIcon

A pointer to the handle to the icon on which to perform the operation.

yourDataPtr

A pointer to data as specified in the yourDataPtr parameter of the ForEachIconDo function. When your application calls ForEachIconDo, it typically provides in the yourDataPtr parameter a value that identifies the action your function should perform.

function result

A result code.

DISCUSSION

You can perform operations on every icon in an icon suite by providing a pointer to an icon action function as a parameter to the ForEachIconDo function. The ForEachIconDo function calls your icon action function for specified icon resource types. Your icon action function should return a result code indicating whether it successfully performed the action on the icon.

The pointer which you pass to the ForEachIconDo function should be a universal procedure pointer (UPP). The definition of the UPP for your icon action callback function is as follows:

typedef (IconActionProcPtr) IconActionUPP;

Before using your icon action function, you must first create a new universal procedure pointer to it, using the NewIconActionUPP function, as shown here:

IconActionUPP MyIconActionUPP;

MyIconActionUPP = NewIconActionUPP(&MyIconActionProc);

You then pass MyIconActionUPP to the ForEachIconDo function. If you wish to call your own icon action function, you may use the InvokeIconActionUPP function:

anError = InvokeIconActionUPP(theType, &theIcon, &myData, MyIconActionUPP);

When you are finished with your icon action callback function, you should dispose of the universal procedure pointer associated with it:

DisposeIconActionUPP(MyIconActionUPP);

AVAILABILITY

Supported in Carbon.


© 2000 Apple Computer, Inc. — (Last Updated 4/18/2000)